<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .da{
            height: 300px;
            display: flex;
        }
        .zuo img{
            width: 300px;
            height: 300px;
        }
        .zuo{
            position: relative;
        }
        .mc{
            pointer-events: none;
            width: 150px;
            height: 150px;
            background-color: rgba(0,0,0,0.3);
            position: absolute;
            left: 0;
            top: 0;
            display: none;
        }
        li{
            list-style: none;
            margin-left: 15px;
            margin-bottom: 2px;
        }
        li img{
            width: 60px;
            height: 45px;
        }
        .r{
            width: 300px;
            height: 300px;
            background-image: url(./hytp/一打七.jpeg);
            background-size: 600px 600px;
            margin-left: 10px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="da">
        <div class="zuo">
            <img src="./hytp/一打七.jpeg">
            <div class="mc">

            </div>
        </div>
        <div class="zo">
            <ul>
                <li><img src="./hytp/一打七.jpeg"></li>
                <li><img src="./hytp/忍战.jpg"></li>
                <li><img src="./hytp/永带妹.jpg"></li>
                <li><img src="./hytp/疾风.jpg"></li>
                <li><img src="./hytp/马达啦.jpg"></li>
                <li><img src="./hytp/鸣人.jpg"></li>
            </ul>
        </div>
        <div class="r" >

        </div>
    </div>
</body>
</html>
<script>
    //获取元素
    var imgs=document.querySelectorAll('li img')
    var zt=document.querySelector('.zuo img')
    var mc=document.querySelector('.mc')
    var r=document.querySelector('.r')
    //循环换小图片加边框
    for(i=0;i<imgs.length;i++){
        //点击事件-加边框-排他
        imgs[i].onclick=function(){
            for(i=0;i<imgs.length;i++){
                //排他-干掉所有人
                imgs[i].style.border=''
            }
            //排他-留下我自己
            this.style.border='2px solid blue'
            //点击切换图片
            zt.src=this.src
        }
        //滑过事件
        imgs[i].onmouseover=function(){
            this.style.border='2px solid red'
        }
        //滑出事件
        imgs[i].onmouseout=function(){
            this.style.border=''
        }
    }
    //鼠标进入左盒子区域显示蒙层和右盒子
    zt.onmouseenter=function(){
        mc.style.display='block'
        r.style.display='block'
    }
    zt.onmouseleave=function(){
        mc.style.display='none'
        r.style.display='none'
    }
    //蒙层移动、放大、右盒子跟随移动
    zt.onmousemove=function(e){
        var x=e.pageX-75
        var y=e.pageY-75
        //x轴最小值
        x=x<0?0:x;
        //y轴最小值
        y=y<0?0:y;
        //x轴最大值
        x=x>150?150:x
        //y轴最大值
        y=y>150?150:y
        mc.style.left=x+'px'
        mc.style.top=y+'px'
        //右图片切换
        r.style.backgroundImage= `url(${this.src})`;
        //右图放大蒙层区域
        r.style.backgroundPosition=`${-2*x}px ${-2*y}px`
    }
</script>